<template>
    <s-layout title="任务上传记录">
		<view class="uni-container">
			<uni-table ref="table" :loading="loading" border stripe type="" emptyText="暂无更多数据" @selection-change="selectionChange">
				<uni-tr>
					<uni-th  align="center">时间	</uni-th>
					<!-- <uni-th  align="center">状态</uni-th> -->
					<uni-th  align="center">状态</uni-th>
				</uni-tr>
				<uni-tr v-for="(item, index) in state.tableData" :key="index" >
					<uni-td align="center">
					<!-- 	<view class="uni-group">
							<u-text v-if='item.record_list_status == 0'>待审核</u-text>
						</view> -->
						<!-- <view class="uni-group"> -->
							{{ item.record_list_createtime }}
						<!-- </view> -->
					</uni-td>
					<!-- <uni-td align="center">
							<u-text v-if='item.record_list_status == 0'>待审核</u-text>
							<u-text v-if='item.record_list_status == 1'>已完成</u-text>
							<u-text v-if='item.record_list_status == 2'>已拒绝</u-text>
					</uni-td>	 -->
			
					<uni-td align="center">
							<button class="uni-button" size="mini" type="primary" @click="toOrderInfo(item.id)">详情</button>
					</uni-td>
				</uni-tr>
			</uni-table>
			<view class="uni-pagination-box">
				<uni-pagination show-icon :page-size="pageSize" :current="pageCurrent" :total="total" @change="change" />
			</view>
		</view>
    </s-layout>
  </template>
  
  <script setup>
    import { ref,reactive } from 'vue'
    import { onLoad, onReachBottom, onPullDownRefresh } from '@dcloudio/uni-app';
    import sheep from '@/sheep';

    const state = reactive({
        pagination: {
            data: [],
            current_page: 1,
            total: 1,
            last_page: 1,
			
			searchVal: '',

        },
        model:{},
        loadStatus: '',
        deleteOrderId: 0,
        error: 0,
		
		
		tableData: [],
		// 每页数据量
		pageSize: 10,
		// 当前页
		pageCurrent: 1,
		// 数据总量
		total: 0,
		loading: false
    })
    

    async function getOrderList(page = 1, list_rows = 5) {
      state.loadStatus = 'loading';
      let res = await sheep.$api.taskorder.getUserOrderList({
        id:state.model.id,
        list_rows,
        page,
      });
      state.error = res.error;
      if (res.code === 1) {
        let tableData = res.data.list.data//_.concat(state.pagination.data, res.data.data);
		state.tableData = tableData
		
  //       state.pagination = {
  //         ...res.data.list,
  //         data: data,
  //       };
  
        if (state.pagination.current_page < state.pagination.last_page) {
          state.loadStatus = 'more';
        } else {
          state.loadStatus = 'noMore';
        }
      }
    }


	function toOrderInfo(id)
	{
	    sheep.$router.go('/pages/task/comment/detail', {
		  id,
		});
	}

    onLoad(async (options) => {
        console.log(options)
        if(options.orderID){
            state.model.id = options.orderID
        }

        getOrderList();
    })

  </script>
  
  <style lang="scss" scoped>
.uni-group {
	display: flex;
	align-items: center;
}
  </style>
  